package code.rocky.week.s103;

public class FindMaxFish {

    public static void main(String[] args) {
        int[][] grid = new int[][]{
                {0, 2, 1, 0},
                {4, 0, 0, 3},
                {1, 0, 0, 4},
                {0, 3, 2, 0}
        };
        FindMaxFish findMaxFish = new FindMaxFish();
        System.out.println(findMaxFish.findMaxFish(grid));
    }

    public int findMaxFish(int[][] grid) {
        int max = 0;
        int res = 0;
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j < grid[0].length; j++) {
                if (grid[i][j] > 0) {
                    res += grid[i][j];
                }
            }
            max = Math.max(res, max);
        }
        return max;
    }
}
